package com.kotlin.dongdong.demo.ui.login

import android.util.Log
import android.view.View
import com.kotlin.dongdong.framework.R
import com.kotlin.dongdong.framework.base.BaseActivity
import com.kotlin.dongdong.framework.http.resultentity.BackResult
import com.kotlin.dongdong.framework.http.resultentity.BookEntity
import com.kotlin.dongdong.framework.http.resultentity.loginEntity

/**
 * Created by dongdongzheng on 2018/2/12.
 */
class LoginActivity : BaseActivity<LoginPresenter, LoginModel>(), LoginContract.View, View.OnClickListener {


    override fun getBookResult(entity: BookEntity) {
        //TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.

        Log.d("测试apiget接口返回数据", entity.image)

    }


    override fun getViewId(): Int {
        return R.layout.activity_login;
    }

    override fun initPresenter() {
        mPresenter!!.setVM(this, mModel!!)
    }

    override fun initView() {
        findViewById<View>(R.id.tv_login_action).setOnClickListener(this)
    }

    override fun initDate() {
//        mPresenter!!.login("", "")
    }

    override fun initListener() {
        // TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.
    }


    override fun onResultError(error: String) {
        //TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.
        Log.d("测试请求错误", error)

    }

    override fun loginRexult(entity: BackResult<loginEntity>) {
        //TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.
    }

    override fun onClick(v: View?) {
        //TODO("not implemented") //To change body of created functions use File | Settings |
        // File Templates.

        if (v!!.id == R.id.tv_login_action) {
            mPresenter!!.getBook()
        }
    }


}